package com.ichina.chat.dao;

import java.util.Date;
import java.util.List;

import com.ichina.chat.util.Page;
import com.ichina.chat.vo.Question;

public interface QuestionDao 
{
	/**
	 * 插入一个问题
	 * @param q 问题的对象
	 * @throws Exception
	 */
	public void addQuestion(Question q) throws Exception;
	
	/**
	 * 根据qid删除
	 * @param qid
	 * @throws Exception
	 */
	public void deleteQuestionByQid(int qid) throws Exception;
	
	/**
	 * 根据用户删除
	 * @param user
	 * @throws Exception
	 */
	public void deleteQuestionByUser(String user) throws Exception;
	
	/**
	 * 根据用户与类型删除
	 * @param user
	 * @param typeid
	 * @throws Exception
	 */
	public void deleteQuestionByUserAndTypeid(String user,int typeid) throws Exception;
	
	/**
	 * 根据关键字与用户模糊查询(分页)
	 * @param word
	 * @param username
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public List<Question> queryQuestionByUser(String word,String username,Page page) throws Exception;
	
	/**
	 * 根据类型查询带分页
	 * @param typeid
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public List<Question> queryQuestionByType(int typeid,Page page) throws Exception;
	
	/**
	 * 根据类型与用户查询带分页
	 * @param username
	 * @param typeid
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public List<Question> queryQuestionByTypeAndUser(String username,int typeid,Page page) throws Exception;
	
	/**
	 * 根据时间查询带分页
	 * @param time
	 * @return
	 * @throws Exception
	 */
	public List<Question> queryQuestioinByTime(Date time,String user,Page page)throws Exception;
	
	/**
	 * 更新问题内容
	 * @param q
	 * @throws Exception
	 */
	public void updateQuestion(Question q) throws Exception;
	
	/**
	 * 查询全部记录条数
	 * @return
	 * @throws Exception
	 */
	public int queryQuestionAll() throws Exception;
	
	/**
	 * 根据用户查找记录
	 * @return
	 * @throws Exception
	 */
	public List<Question> queryRecondByUser(String user,Page page) throws Exception;
	
	/**
	 * 根据日期分组
	 * @return
	 * @throws Exception
	 */
	public List queryRecondByDate() throws Exception;
	
	/**
	 * 根据用户找记录
	 */
	public List queryRecondByUser(String user) throws Exception;
	
	/**
	 * 根据用户,时间找记录
	 */
	public List queryRecondByUser_date(String user,String date) throws Exception;
}
